<html>
<head>
<title>ECAVA IntegraXor - Quantity Bay</title>
</head>
<SCRIPT type="text/javascript" SRC="system/scripts/_gen.js"></SCRIPT>
<SCRIPT type="text/javascript" SRC="system/scripts/_ig.js"></SCRIPT>
<!-- <SCRIPT type="text/javascript" SRC="system/scripts/igrX.js"></SCRIPT> -->
<script type="text/javascript">
    var tag = ['kk_bay']; //['A11','A12','A13','A14','A15'];
    var pool= new tagPool();
    //var aArgs = new Array(5);
	
function getfocus(){
    try {
	var bay = document.getElementById('bay');
    if (bay) bay.focus();
    if (bay) bay.select();
    }catch(e){}
}
	
function onInit() {

pool.get('kk_UM');

}

function onOk() {
    
	var total_raw = pool.get('kk_UM');
    var value = document.getElementById('bay').value;
	
	if (value <= total_raw && value >= 0) {
	
	var answer = confirm("You are selected " + value + " raw material(s) to process. Proceed? ");
    if (answer) {
	  
	  for(var i in tag) {
	  
		pool.set(tag[i],document.getElementById(tag[i]).value);
	  }
	  parent.document.body.removeChild( parent.document.getElementById('layer_pop'));
	}
	}
	
	else if (total_raw == 0) {
		alert("There are " + total_raw + " raw material in the storage, please run a Store Raw Material first. \nThank you!");
	}
	
	else{
		alert("Only " + total_raw + " raw material(s) can be process, please key in a valid number. \nThank you!");
	}
}

function onCancel() {
    top.document.getElementById('bay.html').style.display = 'none';
}

function getXmlHttp() {
  var xmlreq = null;
  if (window.XMLHttpRequest) {
    xmlreq = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    var types = [
      "Microsoft.XMLHTTP",
      "MSXML2.XMLHTTP.5.0",
      "MSXML2.XMLHTTP.4.0",
      "MSXML2.XMLHTTP.3.0",
      "MSXML2.XMLHTTP"
    ];
    for (var i = 0; i < types.length; i++) {
      try             {
        xmlreq = new ActiveXObject(types[i]);
        break;
      } catch(e) {}
    }
  }
  return xmlreq;
}

function getXmlResponse(cmd) {
  var xmlreq = getXmlHttp();
  if (null == xmlreq) {
    return null;
  }
  
  xmlreq.open("GET", cmd, false);
  xmlreq.send("");
  return xmlreq;
}
</script>
<body onload="getfocus(); onInit()" style="margin:5" bgcolor="#e2e3db">

<table class="" align="center" border="0" bordercolorlight="black" bordercolordark="white" width="350">
  <tr>
    <th>Quantity material to produce :</th>
	<th align='center'><input class='editbox' id='bay' type='text' size=5 value=0 style="text-align:center"></th> <!-- <th>Unit</th> -->
  </tr>
  
</table>
<p align="center">
<button type="button" id="bttn_ok" onclick="onOk()">&nbsp;&nbsp;Set&nbsp;&nbsp;</button
</p>
</body>
</html>